package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.StrategyComment;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface StrategyCommentMapper {
    /**
     * 1.根据攻略id分页查询其下的所有评论
     *
     * @param qo
     * @return
     */
    List<StrategyComment> selectForList(QueryObject qo);

    /**
     * 2.维护攻略评论和标签中间表
     *
     * @param strategyCommentId
     * @param tagId
     */
    void insertRelationStrategyCommentAndTag(@Param("strategyCommentId") Long strategyCommentId, @Param("tagId") Long tagId);

    /**
     * 3.根据攻略评论id查询具体攻略评论内容
     *
     * @param commentId
     * @return
     */
    StrategyComment selectByPrimaryKey(Long commentId);

    /**
     * 4.查询最近推荐的10条攻略评论,
     * 按照推荐时间倒序
     * @return
     */
    List<StrategyComment> selectTopComments();

    int deleteByPrimaryKey(Long id);

    /**
     * 5.保存一条攻略评论
     * @param record
     * @return
     */
    int insert(StrategyComment record);


    List<StrategyComment> selectAll();

    int updateByPrimaryKey(StrategyComment record);

}